package ynu.sxp.demoapp.security.dto;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Pattern;
import lombok.Getter;
import lombok.Setter;
import ynu.sxp.demoapp.common.TrimString;

//注册请求对象
@Schema(description = "注册时提交的请求体")
@Getter
@Setter
public class RegisterRO {

    @Schema(description = "用户名", example = "test1")
    @NotEmpty
    @JsonDeserialize(using = TrimString.class)
    @Pattern(regexp = "^\\S{3,20}$", message = "用户名必须是3到20个非空字符")
    private String username;

    @Schema(description = "密码", example = "123456")
    @NotEmpty
    @Pattern(regexp = "^\\S{5,16}$", message = "密码必须是5到16个非空字符")
    private String password;

}
